package com.yxm.controller;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yxm.common.CommonResult;
import com.yxm.entity.Role;
import com.yxm.service.RoleService;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author yxm
 * @since 2020-12-26
 */
@RestController
@RequestMapping("/role")
@Api(tags = "权限模块")
//@AllArgsConstructor     //代替@Autowired依赖注入，但是需要声明为final变量
@RequiredArgsConstructor    //相对于AllArgsConstructor @RequiredArgsConstructor只会注入final注释的属性
public class RoleController {

    private final RoleService roleService;

    @PostMapping("/getAll")
    public CommonResult<List<Role>> getAllRole(){
        List<Role> list = roleService.list(new LambdaQueryWrapper<Role>().eq(Role::getRoleName,"insert"));
        return CommonResult.success(list);
    }
}

